package team.szm.scd.database.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import team.szm.scd.database.entity.Disease;
import team.szm.scd.database.vo.DiseaseVO;

import java.util.List;

@Repository
public interface DiseaseMapper extends BaseMapper<Disease> {
//    @Select("SELECT dsname as name, dpname as departmentName, dsinfo as info," +
//            "cure_time as cureTime, infectious, dsid as id \n" +
//            "FROM disease join department d on d.dpid = disease.dpid \n" +
//            "WHERE dsname like CONCAT('%',#{name},'%') or dsinfo like CONCAT('%',#{name},'%')")
//    List<DiseaseVO> diseaseLikeNameOrLikeInfo(String name);

    @Select("SELECT dsname as name, dpname as departmentName, dsinfo as info," +
            "cure_time as cureTime, infectious, dsid as id \n" +
            "FROM disease natural join department d \n" +
            " ${ew.customSqlSegment}")
    List<DiseaseVO> diseaseFromQueryWrapper(@Param("ew") Wrapper<DiseaseVO> wrapper);
}
